home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / objectLayer.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.6 KB  |  78 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //  Alias|Wavefront Script File
  18. // MODIFY THIS AT YOUR OWN RISK
  19. //
  20. // Creation Date: Oct 19, 1998
  21. //<doc>
  22. //<name objectLayer>
  23. //<owner "Alias|Wavefront Unsupported">
  24. //<synopsis>
  25. //    string objectLayer( string )
  26. //<keywords>
  27. //        DAG displayLayer layer member
  28. //
  29. //<description>
  30. //      All eligible objects (ie. DAG objects) must be in exactly one layer.
  31. //      This script returns the layer to which the given object belongs.
  32. //
  33. //<flags>
  34. //      string $object
  35. //          The name of the object who's layer is to be found.
  36. //
  37. //<examples>
  38. //      // Create an object, which will automatically go into the defaultLayer
  39. //      createNode transform -n father;
  40. //      objectLayer father;
  41. //      // Result : defaultLayer //
  42. //
  43. //      // Put the object into a layer and verify membership
  44. //      createDisplayLayer -e -n fatherLayer;
  45. //      editDisplayLayerMembers fatherLayer father;
  46. //      objectLayer father;
  47. //      // Result : fatherLayer //
  48. //
  49. //      // The time node is not a DAG node and so has no layer
  50. //      objectLayer time1;
  51. //
  52. //      // The above blank line indicates that there was no return value
  53. //
  54. //<returns>
  55. //      string: The layer the object belongs to.  NULL if the object is
  56. //              not eligible for layer membership.
  57. //</doc>
  58. //
  59.  
  60. global proc string objectLayer(string $object)
  61. {
  62.     // First determine that the object is a legal layer member.
  63.     string $drawOvr = ($object + ".drawOverride");
  64.     if( ! `objExists $drawOvr` )
  65.     {
  66.         return "";
  67.     }
  68.  
  69.     // Now look across the draw override connection to find the layer it
  70.     // belongs to.
  71.     string $connList[] = `listConnections -t displayLayer -d false $drawOvr`;
  72.     if( size($connList) == 1 )
  73.     {
  74.         return $connList[0];
  75.     }
  76.     return "defaultLayer";
  77. }
  78.